﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;

namespace YmSoft.Old.Vm
{
    public class BaseNotifyPropertyChanged : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        static bool? isInDesignMode;
        protected bool IsInDesignMode
        {
            get
            {
                if (isInDesignMode != null)
                {
                    return isInDesignMode.Value;
                }
                isInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject());
                //System.Diagnostics.Debug.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().Location);
                //if (System.Reflection.Assembly.GetExecutingAssembly().Location.Contains("VisualStudio"))
                //{
                //    isInDesignMode = true;
                //}
                //isInDesignMode = false;
                return isInDesignMode.Value;
            }
        }
    }
}
